package com.grizz.snake.map;

import java.awt.Dimension;

import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.tiled.TiledMap;

public class Map {
	private TiledMap map;
	
	private Dimension tilesDimension;
	private Dimension mapDimension;
	
	public Map(TiledMap map) {
		this.map = map;
		tilesDimension = new Dimension(map.getTileWidth(), map.getTileHeight());
		mapDimension = new Dimension(map.getWidth(), map.getHeight());
	}
	
	public boolean isWalkable(Vector2f p){
		int tileID = map.getTileId((int)p.x, (int)p.y, map.getLayerIndex("Collision"));
		return tileID == 0;
	}

	public void render() {
		map.render(0, 0);
	}
	
	public Dimension getTilesDimension(){
		return tilesDimension;
	}
	
	public Dimension getMapDimension(){
		return mapDimension;
	}

}
